<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    
    <meta http-equiv="content-language" content="zh-CN" />
    

    
    <meta name="viewport" content="width=device-width, initial-scale=0.5">
    

    
    <title>matlab优化工具03全局优化之ga</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.8/clipboard.min.js"></script>
    
    
    
    
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css">

    
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap-theme.min.css">

    <link rel="stylesheet" href="/css/stylesheet.css">
    <link rel="stylesheet" href="/css/home.css">

    
    
        <style type="text/css">
        body { background-color: #fbf6ec;}
        </style>
    
    
                
        
        
            <link rel="stylesheet" href="/css/main.css"/>
        




        
        
        
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.3.2/styles/github.min.css"  />
         
        
        <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.3.2/highlight.min.js"></script>
        
        
        <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.3.2/languages/r.min.js"></script>
        
        <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.3.2/languages/yaml.min.js"></script>
        
        <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.3.2/languages/latex.min.js"></script>
        
        <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.3.2/languages/matlab.min.js"></script>
        
        <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.3.2/languages/mathematica.min.js"></script>
        
        <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.3.2/languages/julia.min.js"></script>
        
        <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.3.2/languages/julia-repl.min.js"></script>
        
        <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.3.2/languages/powershell.min.js"></script>
        
        <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.3.2/languages/bash.min.js"></script>
        
        <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.3.2/languages/shell.min.js"></script>
        
        <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.3.2/languages/python.min.js"></script>
        
        <script>hljs.initHighlightingOnLoad();</script>
     <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
          
     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css" integrity="sha512-+4zCK9k+qNFUR5X+cKL9EIR+ZOhtIloNl9GIKS57V1MyNsYpYcUrUeQc9vNfzsWfV28IaLL3i96P9sdNyeRssA==" crossorigin="anonymous" />
     
     
</head>


<body>
    <script>
        window.addEventListener("resize", resizeThrottler, false);

        var resizeTimeout;
        function resizeThrottler() {
        
        if ( !resizeTimeout ) {
            resizeTimeout = setTimeout(function() {
            resizeTimeout = null;
            actualResizeHandler();
        
            
            }, 66);
        }
        }
        actualResizeHandler()
        function actualResizeHandler() {
                if (/mobile/i.test(navigator.userAgent) || /android/i.test(navigator.userAgent))
                {
                    document.body.classList.add('mobile');
                }else{
                    document.body.classList.remove('mobile');  
                }
    }</script>

    
      
      
            <nav class="navbar navbar-default navbar-static-top" style="opacity: .9" role="navigation">
        <div class="container-fluid">
            
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">

                    <span class="sr-only">Toggle navigation</span>
                    <span class="big-icon icon-bar"></span>
                    <span class="big-icon icon-bar"></span>
                    <span class="big-icon icon-bar"></span>

                </button>
                <a class="navbar-brand" href="/">zsc</a>
            </div>

            <div class="navbar-collapse collapse" id="bs-example-navbar-collapse-1" style="height: auto;">
                <ul class="nav navbar-nav navbar-right" style="font-size: 100%">
                    
                        
                            
                            <li class=""><a href="/about/">About</a></li>
                            
                            <li class=""><a href="/categories/">Categories</a></li>
                            
                            <li class=""><a href="/">Home</a></li>
                            
                            <li class=""><a href="/tags/">Tags</a></li>
                            
                            <li class=""><a href="/issue/">存在的问题</a></li>
                            
                        
                    
                </ul>
            </div>
        </div>
    </nav>







<div class = "div-content" id='div-content-my' style='display: none;' >
    

    <div class = 'inner-left' id= 'divTableOfContents' style="position:fixed;z-index:999;height: 55%;overflow: scroll;bottom: 5%;width: 22%;top: 25%" >
            <p class="slide slidemy" align = "center">
                <a href="javascript:hidediv();" id="strHref" class="btn-slide">目录收起-</a>
            </p>
            
            <div id="divtocTableOfContents">
            <nav id="TableOfContents">
  <ul>
    <li>
      <ul>
        <li><a href="#一般模型及函数解释">一般模型及函数解释</a></li>
        <li><a href="#例1">例1:</a></li>
      </ul>
    </li>
  </ul>
</nav>
            </div>
    </div>
</div>
<script>  
    $(document).ready(function () {
    var demo = $("#divtocTableOfContents").find("a").length;
    if(demo > 2){
        $("div#div-content-my").fadeIn("slow");
    }
        
        
        
        
        
        
        
        
    }); 
</script>  









<div class="inner">
    



    <div class="blog-post">
        
                <div>
            <h2 align="center" id = "singe-h2">
                matlab优化工具03全局优化之ga
                <time>
                    <br>
                    <span> 
                        <i class="fa fa-user-edit" style="color:#888;font-size: 80%;"></i>
                        zsc 
                    </span>
                    &nbsp 
                    <span>                 
                        <i class="fa fa-calendar-alt" style="color:#888;font-size: 80%;"></i>
                        2021-05-16 
                    </span>
                </time>
                
                
                <div>
                    <ul class="tags">
                        
                        <span>标签:</span>
                        <li><a class="link" href="/tags/matlab"> #matlab </a></li>
                        
                        <span> </span>
                        
                    </ul>
                    
                </div>
            </h2>
        </div>
    
        
        <section id="content">
            <h1 id="matlab优化工具03全局优化之ga">matlab优化工具03全局优化之ga</h1>
<p>首先,要明白遗传算法的基本思路,然后再利用这个函数求解问题,是非常方便的.</p>
<p>新版本中很多优化函数的属性设置都采用: <code>optimoptions('优化函数', '属性1','属性值1',....) </code></p>
<p>故<code>gaoptimset</code>不推荐了,但是基本都差不多,可能个别参数名变了</p>
<h3 id="一般模型及函数解释">一般模型及函数解释</h3>
<p>$$
\begin{aligned}
&amp; \min \quad  f(x) \
&amp; \text {s.t.} \begin{cases}
\textbf{A} \cdot x \leq b \
\textbf{Aeq} \cdot x=beq \
c(x) \leq 0 \
\operatorname{ceq}(x)=0 \
l b \leq x \leq u b
\end{cases}
\end{aligned}
$$</p>
<p>其中 $f(x)$是目标函数, $x, b, beq$ 是向量, $\textbf{A}, \textbf{Aeq}$是矩阵,$c(x)$ 和 $ceq(x)$ 是向量函數, $\textbf{A}$线性不等式,$\textbf{Aeq}$线性等式, $c(x)$ 非线性不等式, $ceq(x)$非线性等式</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-matlab" data-lang="matlab"><span style="display:flex;"><span>(求解最小值)语法:
</span></span><span style="display:flex;"><span>x = ga(fun,nvars,A,b,[],[],lb,ub,nonlcon,IntCon,options)
</span></span><span style="display:flex;"><span>[x,fval,exitflag,output,population,scores] = ga(___)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">% 解释:</span>
</span></span><span style="display:flex;"><span>fun 为适应度句柄函数, 一般其输入为<span style="color:#ae81ff">1</span><span style="color:#f92672">*</span>nvars的向量
</span></span><span style="display:flex;"><span>nvars, 即目标函数自变量的个数
</span></span><span style="display:flex;"><span>A,b,Aeq,beq,LB,UB,nonlcon参数与fmincon中类似,不在解释
</span></span><span style="display:flex;"><span>IntCon, 整数约束, 指定变量的下标则说明该变量为整数变量
</span></span><span style="display:flex;"><span>options, 算法的属性设置
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>x,最优解
</span></span><span style="display:flex;"><span>fval, 最优解对应的目标函数值
</span></span><span style="display:flex;"><span>exitflag, 算法停止的原因
</span></span><span style="display:flex;"><span>output, 输出算法结构
</span></span><span style="display:flex;"><span>population, 最终得到种群适应度的列向量
</span></span><span style="display:flex;"><span>scores, 最终得到的种群
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>options = optimoptions(<span style="color:#e6db74">&#39;ga&#39;</span>,<span style="color:#e6db74">&#39;PlotFcn&#39;</span>,@gaplotbestf);
</span></span><span style="display:flex;"><span>optimoptions
</span></span></code></pre></div><p>**Optimization 解读, 详细解读,参考官网,这里只给出一些概念 **</p>
<ul>
<li><code>{}</code> 里面的值为默认值</li>
<li><code>{}*</code>表示存在线性约束时的默认值，对于MutationFcn，也表示存在边界时的默认值。</li>
<li><code>I*</code> 表示ga以不同方式处理整数约束的选项;；此符号不适用于gamultiobj。</li>
<li><strong>NM</strong> 表示该选项不适用于gamultiobj。</li>
<li><strong>Options for <code>ga</code>, Integer <code>ga</code>, and <code>gamultiobj</code></strong></li>
</ul>
<table>
<thead>
<tr>
<th><strong>Option</strong></th>
<th>Description</th>
<th><strong>Values</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><code>ConstraintTolerance</code></td>
<td>用以确定非线性约束的可行性,<br>对于选项结构，请使用TolCon。</td>
<td>Positive scalar | <code>{1e-3}</code></td>
</tr>
<tr>
<td>CreationFcn</td>
<td>建立初始种群的函数句柄</td>
<td><code>{'gacreationuniform'}</code></td>
</tr>
<tr>
<td><code>CrossoverFcn</code></td>
<td>子代交叉的函数句柄</td>
<td><code>{'crossoverscattered'}</code> for <code>ga</code>, <code>{'crossoverintermediate'}*</code>for <code>gamultiobj</code></td>
</tr>
<tr>
<td>CrossoverFraction</td>
<td>交叉概率, 不包含由CrossoverFcn产生的子代</td>
<td>Positive scalar | <code>{0.8}</code></td>
</tr>
<tr>
<td><code>Display</code></td>
<td>Level of display.</td>
<td><code>'off'</code></td>
</tr>
<tr>
<td><code>DistanceMeasureFcn</code></td>
<td>For <code>gamultiobj</code> only. 拥挤度函数</td>
<td><code>{'distancecrowding'}</code></td>
</tr>
<tr>
<td><code>EliteCount</code></td>
<td>在当前这一代种群中指定保证在下一代存活的精英个体数目</td>
<td>Positive integer |<code>{ceil(0.05*PopulationSize)}</code></td>
</tr>
<tr>
<td><code>FitnessLimit</code></td>
<td><strong>NM</strong>, 如果适应度函数的值达到 FitnessLmit 的值，则算法停止</td>
<td>Scalar | <code>{-Inf}</code> <br>即为一个实数，默认值 为 -lnf</td>
</tr>
<tr>
<td>FitnessScalingFcn</td>
<td>对适应度函数的值进行缩放, gamultiobj选项不可用。</td>
<td><code>{'fitscalingrank'}</code></td>
</tr>
<tr>
<td><code>FunctionTolerance</code></td>
<td>容忍度, For an options structure, use TolFun.</td>
<td>Positive scalar | <code>{1e-6}</code> for <code>ga</code>, <code>{1e-4}</code> for <code>gamultiobj</code></td>
</tr>
<tr>
<td><code>HybridFcn</code></td>
<td><code>I*</code>  在ga终止后继续优化的函数。指定为名称或函数句柄。</td>
<td>Function name or handle</td>
</tr>
<tr>
<td><code>InitialPopulationMatrix</code></td>
<td>初始种群.<br>For an options structure, use InitialPopulation.</td>
<td>为一个矩阵，默认值为 [ ]</td>
</tr>
<tr>
<td><code>InitialPopulationRange</code></td>
<td>初始种群的范围, 说明种群中数据元素类型的取值范围，</td>
<td>取值为矩阵或向量</td>
</tr>
<tr>
<td><code>InitialScoresMatrix</code></td>
<td>初始适应度函数的评价得分值，</td>
<td>为一个列向量，默认值为 [ ]</td>
</tr>
<tr>
<td>MaxGenerations</td>
<td>最大迭代次数</td>
<td>Positive integer |<code>{100*numberOfVariables}</code> for <code>ga</code>, <code>{200*numberOfVariables}</code> for <code>gamultiobj</code></td>
</tr>
<tr>
<td>MaxStallGenerations</td>
<td>适应度停滞限制.当目标函数在 <code>StallTimeLimit </code>代后没有改 善， 则算法停止，</td>
<td><code>{50}</code> for <code>ga</code>,<br> <code>{100}</code> for <code>gamultiobj</code></td>
</tr>
<tr>
<td>MaxStallTime</td>
<td>适应度停滞限制.当日标函数在 <code>StaLlTimeLimit </code>时间后没有改善，则算法停止，</td>
<td>默认值为 lnf</td>
</tr>
<tr>
<td><code>MaxTime</code></td>
<td>算法总用时,超过后停止</td>
<td>Positive scalar | <code>{Inf}</code></td>
</tr>
<tr>
<td><em>MigrationDirection</em></td>
<td>迁移方向</td>
<td><code>'both'</code></td>
</tr>
<tr>
<td><em>MigrationFraction</em></td>
<td>从一个子种群到另一个子种群的迁移概率</td>
<td>0到1之间的数, 默认值0.2</td>
</tr>
<tr>
<td><em>MigrationInterval</em></td>
<td></td>
<td>Positive integer | <code>{20}</code></td>
</tr>
<tr>
<td><code>MutationFcn</code></td>
<td>产生变异子代的函数句柄</td>
<td><code>{'mutationgaussian'}</code> for <code>ga</code>,  <br><code>{'mutationadaptfeasible'}*</code> for<code>gamultiobj</code></td>
</tr>
<tr>
<td><code>NonlinearConstraintAlgorithm</code></td>
<td>非线性约束算法</td>
<td><code>{'auglag'}</code> for <code>ga</code>, <code>{'penalty'}</code> for <code>gamultiobj</code></td>
</tr>
<tr>
<td><code>OutputFcn</code></td>
<td>ga 在每次迭代中调用的函数，</td>
<td>取值为 <code>@gaoutpulgen</code> 或 [J(默认值〉</td>
</tr>
<tr>
<td><code>ParetoFraction</code></td>
<td>仅用于gamultiobj, 保留帕累托解的比例?</td>
<td>Scalar | <code>{0.35}</code></td>
</tr>
<tr>
<td>PlotFcn</td>
<td>边计算边绘制数据</td>
<td><code>ga</code> or <code>gamultiobj</code>: `{[]}</td>
</tr>
<tr>
<td><code>PopulationSize</code></td>
<td>种群的数量</td>
<td>Positive integer | <code>{50}</code> when <code>numberOfVariables &lt;= 5</code>, <code>{200}</code>otherwise</td>
</tr>
<tr>
<td><code>PopulationType</code></td>
<td>种群中数据元素类型的字符串</td>
<td>&lsquo;bitstring&rsquo;`</td>
</tr>
<tr>
<td><code>SelectionFcn</code></td>
<td>选择句柄函数，用以选择进行交叉和变异的父代</td>
<td><code>{'selectionstochunif'}</code> for <code>ga</code>, <code>{'selectiontournament'}</code> for<code>gamultiobj</code></td>
</tr>
<tr>
<td><code>UseParallel</code></td>
<td>并行计算</td>
<td><code>true</code></td>
</tr>
<tr>
<td>UseVectorized</td>
<td>指定函数是否向量化,<br>For an options structure, use <code>Vectorized</code> with the values <code>'on'</code> or <code>'off'</code>.</td>
<td>true| <code>{false}</code></td>
</tr>
</tbody>
</table>
<p><img src="https://cdn.jsdelivr.net/gh/zscmmm/imgs2208save@master/uPic/202105151602image-20210515160230482.png" alt="image-20210515160230482"></p>
<p><img src="https://cdn.jsdelivr.net/gh/zscmmm/imgs2208save@master/uPic/202105151602image-20210515160240881.png" alt="image-20210515160240881"></p>
<p><img src="https://cdn.jsdelivr.net/gh/zscmmm/imgs2208save@master/uPic/202105151603image-20210515160305942.png" alt="image-20210515160305942"></p>
<ul>
<li><strong>可以通过输出 output 参数, 来设置算法参数</strong></li>
</ul>
<h3 id="例1">例1:</h3>
<p>$$
min \quad g(x) = (x_1 -10)^3 + (x_2 -20 )^3  \
s.t. \begin{cases}
(x_1 - 5)^2 + (x_2 - 5)^2 \geq 100\
13\leq x_1 \leq 100 \
0 \leq x_2 \leq 100
\end{cases}\
已知的最优点和最优值 g(x^*) = g(14.095,0.84296) = -6961.81381
$$</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-matlab" data-lang="matlab"><span style="display:flex;"><span>clc,clear all;
</span></span><span style="display:flex;"><span>A = [];
</span></span><span style="display:flex;"><span>b = [];
</span></span><span style="display:flex;"><span>Aeq = [];
</span></span><span style="display:flex;"><span>beq = [];
</span></span><span style="display:flex;"><span>lb = [<span style="color:#ae81ff">13</span>,<span style="color:#ae81ff">0</span>];
</span></span><span style="display:flex;"><span>ub = [<span style="color:#ae81ff">100</span>,<span style="color:#ae81ff">100</span>];
</span></span><span style="display:flex;"><span>nvars = <span style="color:#ae81ff">2</span>;
</span></span><span style="display:flex;"><span>options = optimoptions(<span style="color:#e6db74">&#39;ga&#39;</span>,<span style="color:#e6db74">&#39;Display&#39;</span>,<span style="color:#e6db74">&#39;final&#39;</span>,<span style="color:#e6db74">&#39;PlotFcn&#39;</span>,<span style="color:#e6db74">&#39;gaplotbestf&#39;</span>,<span style="color:#e6db74">&#39;FunctionTolerance&#39;</span>,<span style="color:#ae81ff">1e-6</span>);
</span></span><span style="display:flex;"><span>[x,fval] = ga(@myobjfun2,nvars ,A,b,Aeq,beq,lb,ub,@constrain,options)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">%% 目标函数</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">function</span> f = <span style="color:#a6e22e">myobjfun2</span>(x)
</span></span><span style="display:flex;"><span>f = (x(<span style="color:#ae81ff">1</span>) <span style="color:#f92672">-</span> <span style="color:#ae81ff">10</span>)^<span style="color:#ae81ff">3</span> <span style="color:#f92672">+</span> (x(<span style="color:#ae81ff">2</span>) <span style="color:#f92672">-</span> <span style="color:#ae81ff">20</span>)^<span style="color:#ae81ff">3</span>;
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">end</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">%% 非线性约束</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">function</span> [c, ceq] = <span style="color:#a6e22e">constrain</span>(x)
</span></span><span style="display:flex;"><span><span style="color:#75715e">% 非线性不等式约束</span>
</span></span><span style="display:flex;"><span>c = <span style="color:#ae81ff">100</span> <span style="color:#f92672">-</span> (x(<span style="color:#ae81ff">1</span>) <span style="color:#f92672">-</span> <span style="color:#ae81ff">5</span>)^<span style="color:#ae81ff">2</span> <span style="color:#f92672">-</span> (x(<span style="color:#ae81ff">2</span>)<span style="color:#f92672">-</span><span style="color:#ae81ff">5</span>)^<span style="color:#ae81ff">2</span>;
</span></span><span style="display:flex;"><span><span style="color:#75715e">% 非线性等式约束</span>
</span></span><span style="display:flex;"><span>ceq = [];
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">end</span>
</span></span></code></pre></div><p>结果如下:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-matlab" data-lang="matlab"><span style="display:flex;"><span>Optimization terminated: average change in the fitness value less than options.FunctionTolerance
</span></span><span style="display:flex;"><span> and constraint violation is less than options.ConstraintTolerance.
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>x =
</span></span><span style="display:flex;"><span>   <span style="color:#ae81ff">13.6602</span>    <span style="color:#ae81ff">0.0000</span>
</span></span><span style="display:flex;"><span>fval =
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">-</span><span style="color:#ae81ff">7.9509e+03</span>
</span></span></code></pre></div><p>不知道为什么? 居然比上面给出的结果还要好.  上题来源于 &laquo;智能优化算法及其应用（王凌著）.pdf&raquo;第一章绪论 第8页 — — 第6个函数</p>
<p>参考:</p>
<ul>
<li>
<p>《MATLAB R2015b最优化计算》&ndash;李娅</p>
</li>
<li>
<p><a href="https://www.mathworks.com/help/gads/ga.html">https://www.mathworks.com/help/gads/ga.html</a></p>
</li>
</ul>

        </section>
    </div>
    <br>
    
    




<span id="/md/2021-05-16-matlab%E4%BC%98%E5%8C%96%E5%B7%A5%E5%85%B703%E5%85%A8%E5%B1%80%E4%BC%98%E5%8C%96%E4%B9%8Bga/" class="leancloud_visitors" data-flag-title="matlab优化工具03全局优化之ga">
  <span class="post-meta-item-text">文章总阅读量 </span>
  <span class="leancloud-visitors-count"><i class="leancloud-visitors-count"></i></span>次;
  <p></p>
</span>



    

    
    
    <button id="edit-button" class="icon-button" type="button" title="Fork and edit" aria-label="Fork and edit" aria-haspopup="true" aria-expanded="false" aria-controls="edit">
        <i class="fa fa-edit">编辑本文</i>
    </button>
    
    
    

    <br>
    <hr>
    <li style="float:left;list-style:none">
        
        <a class="previous" href="/md/2021-05-16-matlab%E4%BC%98%E5%8C%96%E5%B7%A5%E5%85%B704quadprog/"> 上一篇: matlab优化工具04二次规划之quadprog</a>
        
    </li>
    <li style="float:right;list-style:none">
        
        <a class="next" href="/md/2021-05-16-matlab%E4%BC%98%E5%8C%96%E5%B7%A5%E5%85%B702%E9%9D%9E%E7%BA%BF%E6%80%A7%E8%A7%84%E5%88%92%E4%B9%8Bfmincon/"> 下一篇: matlab优化工具02非线性规划之fmincon</a>
        
    </li>
     
    
    <script src="/js/copyCode.js"></script>
    <script src="/js/tooltips.js"></script>
    
   
    <script>
    [].slice.call(document.querySelectorAll('table')).forEach(function(el) {
        var wrapper = document.createElement('div');
        wrapper.className = 'table-area';
        el.parentNode.insertBefore(wrapper, el);
        el.parentNode.removeChild(el);
        wrapper.appendChild(el);
        $("table").wrap("<div class='table-area'></div>");
    })
    </script>

    
<br>
<hr>


<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-111691389-1"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag() { dataLayer.push(arguments); }
  gtag('js', new Date());

  gtag('config', 'UA-111691389-1');
</script>




      
      
      

       
      
      
      <script>
              document.getElementById("edit-button").addEventListener("click", function () {
                  var editWindow = window.open("https:\/\/github.com\/zoushucai\/blogmmm/edit/master/content/md\/2021-05-16-matlab优化工具03全局优化之ga.md");
              });</script>
      
          




<script>
  function resizeIframe(obj) {
    obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
  } 
</script>



    </style>
    <script type="text/javascript">
    function showdiv(){
        document.getElementById("divtocTableOfContents").style.display="block";
        document.getElementById("strHref").innerHTML="目录收起-";
        document.getElementById('divTableOfContents').style.width="22%";
        document.getElementById('divTableOfContents').style.height="55%";
        document.getElementById('divTableOfContents').style.top="25%";
        document.getElementById('divTableOfContents').style.bottom="5%";
        document.getElementById("strHref").href="javascript:hidediv()";
    }
    function hidediv(){
        document.getElementById("divtocTableOfContents").style.display="none";
        document.getElementById("strHref").innerHTML="目录展开+";
        document.getElementById("strHref").href="javascript:showdiv()";
        document.getElementById('divTableOfContents').style.width="10%";
        document.getElementById('divTableOfContents').style.height="5%";
    }
    </script>
</body>

</html>
</div> 







    <script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/mathtex-script-type.min.js" integrity="sha384-LJ2FmexL77rmGm6SIpxq7y+XA6bkLzGZEgCywzKOZG/ws4va9fUVu2neMjvc3zdv" crossorigin="anonymous"></script>

    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css">
    <script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js"></script>
    <script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js"></script>
    <script>
        document.addEventListener("DOMContentLoaded", function() {
            renderMathInElement(document.body, {
            delimiters: [
                            {left: "$$", right: "$$", display: true},
                            {left: "$", right: "$", display: false},
                            {left: "\\(", right: "\\)", display: false},
                            {left: "\\[", right: "\\]", display: true}
                        ]
            });
        });
    </script>













<br>
<div class="inner">
              
            
          
          
  
          
  
  <div id="vcomments"></div>
  
  <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
  
  <script src='//unpkg.com/valine/dist/Valine.min.js'></script>
  <script type="text/javascript">
    new Valine({
        el: '#vcomments' ,
        appId: 'HfHPKPkLa0cBEDPcdBAHuqMv-gzGzoHsz',
        appKey: 'r5RJAasN8e0mB9sq6y9pEcX0',
        lang:'zh-CN',
        notify:  false , 
        verify:  false  ,
        avatar:'identicon', 
        placeholder: '说点什么吧...',
        visitor:  true 
    });
  </script>

</div>

<br>
<br>
<footer>
    <p style="float:right;margin-right: 5%;margin-top: 0%;">
        &copy; 2022 <a href="https://github.com/zoushucai">zsc</a>
      </p>
</footer>
<br>
<br>


